import {AxiosPromise} from "axios";
import {Result, TableDataInfo} from "@/model";
import {GroupMsgLastVO, GroupMsgQuery} from "./types";
import request from "@/utils/request";

/**
 * 获取好友之间的最后一条聊天记录
 * @returns 聊天记录
 */
export function getLastGroupMsg(): AxiosPromise<Result<GroupMsgLastVO[]>> {
    return request({
        url: `/groupMsg/getLastGroupMsg`,
        method: "get",
    });
}

/**
 * 查询最近的群消息
 * @returns 聊天记录
 */
export function getRecentGroupMsg(params: GroupMsgQuery): AxiosPromise<TableDataInfo> {
    return request({
        url: `/groupMsg/listRecent`,
        method: "get",
        params,
    });
}

/**
 * 查询群历史消息
 * @returns 聊天记录
 */
export function getHistoryGroupMsg(params: GroupMsgQuery): AxiosPromise<TableDataInfo> {
    return request({
        url: `/groupMsg/listHistory`,
        method: "get",
        params,
    });
}